package com.glasgowrax.domain.directions;

import android.graphics.Paint;
import android.graphics.Path;

public class DirectionsPath extends Path {
	
	private Float initialStartX;
	private Float initialStartY;
	private Float initialEndX;
	private Float initialEndY;
	
	private float totalOffsetX;
	private float totalOffsetY;
	
	private Paint paint;

	public DirectionsPath() {
		super();
	}

	public DirectionsPath(Paint paint) {
		super();
		this.paint = paint;
	}
	
	@Override
	public void moveTo(float x, float y) {
		if (initialStartX == null || initialStartY == null) {
			initialStartX = x;
			initialStartY = y;
		}
		super.moveTo(x, y);
	}
	
	@Override
	public void lineTo(float x, float y) {
		if (initialEndX == null || initialEndY == null) {
			initialEndX = x;
			initialEndY = y;
		}
		super.lineTo(x, y);
	}

	public void setOffset(float x, float y) {		
		super.offset(x - totalOffsetX, y - totalOffsetY);
		totalOffsetX = x;
		totalOffsetY = y;
	}

	public Paint getPaint() {
		return paint;
	}

	public void setPaint(Paint paint) {
		this.paint = paint;
	}

}
